/**
 * 针对S2500 测试绑核缺点 内存
 * @file
 * @author yeqiang@greatwall.com.cn
 * @brief
 * @version 0.1
 * @date 2022-09-19
 *
 * @copyright Copyright (c) 2022
 *
 */
#define _GNU_SOURCE

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include <sched.h>
#include <errno.h>
#include <pthread.h>

// 1GB
#define BLOCK_SIZE 1024 * 1024 * 1024
int main(int argc, char *argv[])
{
    //动态申请256G 内存
    void *buff[256];
    for (int i = 0; i < 256; i++)
    {
        buff[i] = malloc(BLOCK_SIZE);
        if (buff[i] != NULL)
        {
            memset(buff[i], 0, BLOCK_SIZE);
        }
        else
        {
            printf("malloc failed, %d\n", i);
        }
    }
    sleep(60);
    return 0;
}